<?php
/**
 * @see Zend_Validate_Abstract
 */
require_once 'Zend/Validate/Abstract.php';

/**
 * @see Zend_Uri
 */
require_once 'Zend/Uri.php';

/**
 * Wufoo_Form
 *
 * @category   Wufoo
 * @package    Wufoo_Form
 * @copyright  Copyright (c) 2009-2010 Eyeflow Internet Marketing. (http://www.eyeflow.com)
 * @author     Sergei Izvorean
 */
class Wufoo_Validate_Uri extends Zend_Validate_Abstract
{
    const MSG_URI = 'msgUri';

    protected $_messageTemplates = array(
        self::MSG_URI => "Invalid URI",
    );

    public function isValid($value)
    {
        $this->_setValue($value);

        //Validate the URI
        $valid = Zend_Uri::check($value);

        //Return validation result
        if ($valid) {
            return true;
        } else {
            $this->_error(self::MSG_URI);
            return false;
        }
    }
}
